package UnitTest.AlgorithmTest.combineTest.lisTest;

import Algorithm.comprehensive.lis.LIS;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/6/7
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 最长递增子序列 测试案例
 */
public class LIS_Test {

    public void TestDemo(LIS LISImpl) {
        int result = LISImpl.longestIncreasingSubsequence(demo01);
        assert result == 9;
        result = LISImpl.longestIncreasingSubsequence(demo02);
        assert result == 0;
        result = LISImpl.longestIncreasingSubsequence(demo03);
        assert result == 0;
        result = LISImpl.longestIncreasingSubsequence(demo04);
        assert result == 5;
        result = LISImpl.longestIncreasingSubsequence(demo05);
        assert result == 9;
        result = LISImpl.longestIncreasingSubsequence(demo06);
        assert result == 5;
        result = LISImpl.longestIncreasingSubsequence(demo07);
        assert result == 4;
        result = LISImpl.longestIncreasingSubsequence(demo08);
        assert result == 1;
        result = LISImpl.longestIncreasingSubsequence(demo09);
        assert result == 1;
        result = LISImpl.longestIncreasingSubsequence(demo10);
        assert result == 9;
        result = LISImpl.longestIncreasingSubsequence(demo11);
        assert result == 1;
        result = LISImpl.longestIncreasingSubsequence(demo12);
        assert result == 4;
    }

    public void TestDemoStr(LIS LISImpl) {
        int result = LISImpl.longestIncreasingSubsequence(demoStr01);
        assert result == 9;
        result = LISImpl.longestIncreasingSubsequence(demoStr02);
        assert result == 0;
        result = LISImpl.longestIncreasingSubsequence(demoStr03);
        assert result == 0;
        result = LISImpl.longestIncreasingSubsequence(demoStr04);
        assert result == 5;
        result = LISImpl.longestIncreasingSubsequence(demoStr05);
        assert result == 9;
        result = LISImpl.longestIncreasingSubsequence(demoStr06);
        assert result == 5;
        result = LISImpl.longestIncreasingSubsequence(demoStr07);
        assert result == 4;
        result = LISImpl.longestIncreasingSubsequence(demoStr08);
        assert result == 1;
        result = LISImpl.longestIncreasingSubsequence(demoStr09);
        assert result == 1;
        result = LISImpl.longestIncreasingSubsequence(demoStr10);
        assert result == 9;
        result = LISImpl.longestIncreasingSubsequence(demoStr11);
        assert result == 1;
        result = LISImpl.longestIncreasingSubsequence(demoStr12);
        assert result == 4;
        result = LISImpl.longestIncreasingSubsequence(demoStr13);
        assert result == 4;
    }


    // 最长递增子序列 测试数据
    public String demo01 = "1528334656789123456";//123456789
    public String demo02 = "";
    public String demo03 = null;
    public String demo04 = "18386873921";     //13679
    public String demo05 = "1234567823456789";//123456789
    public String demo06 = "13572468";        //12468
    public String demo07 = "24681357";        //2468
    public String demo08 = "987654321";       //1
    public String demo09 = "1";               //1
    public String demo10 = "12834615526431378242287536564437529688";//123456789
    public String demo11 = "777777777777";    //1
    public String demo12 = "010323";          //4

    public int[] demoStr01 = {1, 5, 2, 8, 3, 3, 4, 6, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6};//123456789
    public int[] demoStr02 = {};
    public int[] demoStr03 = {};
    public int[] demoStr04 = {1, 8, 3, 8, 6, 8, 7, 3, 9, 2, 1};               //13679
    public int[] demoStr05 = {1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9};//123456789
    public int[] demoStr06 = {1, 3, 5, 7, 2, 4, 6, 8};   //12468
    public int[] demoStr07 = {2, 4, 6, 8, 1, 3, 5, 7};   //2468
    public int[] demoStr08 = {9, 8, 7, 6, 5, 4, 3, 2, 1};//1
    public int[] demoStr09 = {1};  //1
    public int[] demoStr10 = {1, 2, 8, 3, 4, 6, 1, 5, 5, 2, 6, 4, 3, 1, 3, 7, 8, 2, 4, 2, 2, 8, 7, 5, 3, 6, 5, 6, 4, 4, 3, 7, 5, 2, 9, 6, 8, 8};//123456789
    public int[] demoStr11 = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};//1
    public int[] demoStr12 = {0, 1, 0, 3, 2, 3};//4
    public int[] demoStr13 = {10, 9, 2, 5, 3, 7, 101, 18};//4
}
